import App from './App'
import Variable from '@/utils/variable.js'
import uvUI from '@/uni_modules/uv-ui-tools'
import httpInterceptor from '@/utils/interceptors.js'

import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)

  app.use(uvUI)
  app.config.globalProperties.$var = Variable


  // 配置uvUI http
  uni.$uv.setConfig({
    baseUrl: Variable.BaseUrl,
    header: {
      'content-type': 'application/json'
    }
  })

  // 配置http拦截器
  uni.$uv.http.interceptors.request.use(
    httpInterceptor.request,
    httpInterceptor.error
  )

  uni.$uv.http.interceptors.response.use(
    httpInterceptor.response,
    httpInterceptor.error
  )

  return {
    app
  }
} 